<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3">
<head th:include="public/page_css::page_css ('修改用户')" />

<body>
<div class="layui-fluid larry-wrapper">
    <div class="layui-row layui-col-space30">
        <div class="layui-col-xs24">
            <section class="panel panel-padding">
                <form id="form1" class="layui-form layui-form-pane" action="">
                    <div class="layui-form-item">
                        <label class="layui-form-label">用户地址</label>
                        <div class="layui-input-block">
                            <input type="text" name="userAccount"  required="required" jq-verify="required" jq-error="请输入帐号" placeholder="请输入帐号" autocomplete="off" class="layui-input "/>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">appcode</label>
                        <div class="layui-input-block">
                            <input type="text" name="appCode" placeholder="密码" autocomplete="off" class="layui-input "/>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">密码确认</label>
                        <div class="layui-input-block">
                            <input type="password" name="pwd2" placeholder="密码确认" autocomplete="off" class="layui-input "/>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">所属角色</label>
                        <div class="layui-input-inline">
                            <select name="appId">
                                <option value="3" >管理员</option>
                                <option value="2" >客服</option>
                                <option value="1" > 运营</option>
                            </select>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">select2选择测试</label>
                            <div class="layui-input-inline">
                                <select lay-ignore="lay-ignore" class="js-data-example-ajax" name="telephone2" select2  style="width: 193px"></select>
                                <select lay-ignore="lay-ignore" class="js-data-example-ajax2" name="telephone" select2  style="width: 193px"></select>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">异步字典select</label>
                            <div class="layui-input-inline">
                                <select name="empLevel" id="ascSelect" lay-search>
                                </select>
                            </div>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">姓名</label>
                        <div class="layui-input-block">
                            <input type="text" name="title" placeholder="姓名" autocomplete="off" class="layui-input "/>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">复选框</label>
                        <div class="layui-input-block">
                            <input type="checkbox" name="gender" title="写作" value="1">
                            <input type="checkbox" name="gender" title="阅读" value="2">
                            <input type="checkbox" name="gender" title="发呆" value="3">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">手机</label>
                        <div class="layui-input-block">
                            <input type="text" name="title" placeholder="手机号码" autocomplete="off" class="layui-input "/>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">邮箱</label>
                        <div class="layui-input-block">
                            <input type="text" name="title" placeholder="邮箱" autocomplete="off" class="layui-input "/>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">文本框</label>
                        <div class="layui-input-block">
                            <textarea name="colleage" placeholder="请输入内容" class="layui-textarea"></textarea>                        </div>
                    </div>
                    <div class="layui-form-item" pane="pane">
                        <label class="layui-form-label">状态</label>
                        <div class="layui-input-inline">
                            <input type="radio" name="type" title="启用" value="0"/>
                            <input type="radio" name="type" title="禁用" value="1"/>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <button class="layui-btn" jq-filter="submit" lay-submit="" lay-filter="addUser">立即提交</button>
                            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                        </div>
                    </div>
                    <!--<input type="hidden" th:value="${id}" id="userId">-->
                </form>
            </section>
        </div>
    </div>
</div>
</body>
<div th:include="public/public_js::public_js"></div>

<script th:inline="javascript">
    $(function () {

    })
    function editSelect2(dom,value){

    }
</script>
<script>
layui.use(['myform','zzpUtils','form','jquery'],function () {
        var form = layui.form,
        zzpUtils = layui.zzpUtils,
        $ = layui.jquery;
        zzpUtils.select2({
            elem:".js-data-example-ajax",
            url:"/wmsgoodstype/getWmsGoodsTypeByHzId"
        });
    zzpUtils.select({
        elem:"#ascSelect",
        url:"/sysdictionary/getSysdictionary/wms_shipment_order_detailed_zt"
    });
    zzpUtils.select2({
        elem:".js-data-example-ajax2",
        url:"/wmsgoodstype/getWmsGoodsTypeByHzId",
        multiple:"multiple"
    });
        zzpUtils.action({
            url:"/sysuser/getEditUser",
            data:{
                id:$("#userId").val()
            },
            success:function (data) {
                zzpUtils.loadJsonDataToForm(data);
            },error: function (xhr, textStatus) {
                console.log(textStatus);
                console.log(xhr)
            }
        });

        form.on("submit(addUser)",function(data){
            console.log(zzpUtils.getFormJson($("#form1")));
            zzpUtils.confirm("是否确定添加",function(index){
            zzpUtils.action({
                url:"/userLogin/userLogin",
                data:JSON.stringify(data.field),
                success:function (data) {
                    setTimeout(function(){
                        var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                        parent.layer.close(index); //再执行关闭
                        top.layer.msg("用户添加成功！");
                        //刷新父页面
                        parent.location.reload();
                    },500);
                },error: function (xhr, textStatus) {
                    console.log(textStatus);
                    console.log(xhr)
                }
            })
            })
            return false;

        });
    });
</script>
</html>